package com.zoran.study.spring.model.request;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.zoran.study.spring.validation.constraint.IdentityNumber;
import lombok.Data;
import lombok.ToString;
import org.hibernate.validator.constraints.Length;
import org.springframework.format.annotation.DateTimeFormat;

import javax.validation.Valid;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotEmpty;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;

/**
 * CreditOrder
 *
 * @author zouxm
 * @date 2018/6/27
 */
@Data
@ToString
public class CreditOrder implements Serializable {

    private static final long serialVersionUID = 6112142487024408508L;

    @NotEmpty(message = "{com.zoran.study.validation.credit.order.orderNo.NotBlank.message}")
    @Length(min = 5,max = 10,message = "{com.zoran.study.validation.credit.order.orderNo.NotBlank.message}")
    private String orderNo;

    private BigDecimal amount;

    @NotBlank(message = "{com.zoran.study.validation.identityNumber.NotBlank.message}")
    @IdentityNumber(message = "{com.zoran.study.validation.identityNumber.Format.message}")
    private String identityNumber;

    @JsonFormat
    private Date effectiveTime;

    @Valid
    private SubmitUser submitUser;

}
